//package com.sinothk.widget.loadingRecyclerView.demo.staggeredGridDemo
//
//import android.os.Bundle
//import androidx.appcompat.app.AppCompatActivity
//import androidx.recyclerview.widget.StaggeredGridLayoutManager
//import com.sinothk.widget.loadingRecyclerView.demo.R
//import java.util.*
//
//
//class LoadingRecycleStaggeredGridTestActivity : AppCompatActivity() {
//
//    private var mAdapter: DemoAdapter? = null
//    private var listData: ArrayList<String>? = null
//
//    //    private var refreshTime = 0
//    private var times = 0
//    val pageSize = 20
//
//    override fun onCreate(savedInstanceState: Bundle?) {
//        super.onCreate(savedInstanceState)
//        setContentView(R.layout.activity_loading_recycle_stangrger_edgrid_view_demo_grid)
//
//        initRV()
//        initData()
//    }
//
//    private fun initData() {
//        listData = ArrayList<String>()
//        for (i in 0 until pageSize) {
//            listData!!.add("item_$i")
//        }
//        mAdapter = DemoAdapter()
//        mAdapter!!.replaceAll(listData)
//        recyclerView.adapter = mAdapter
//    }
//
//
//    private fun initRV() {
//        // 瀑布流
//        val layoutManager = StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)
//        //防止Item切换
//        layoutManager.gapStrategy = StaggeredGridLayoutManager.GAP_HANDLING_NONE
//        recyclerView.layoutManager = layoutManager
//        recyclerView.addItemDecoration(recyclerView.getStaggeredGridViewLine(10))
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
////        // 设置刷新样式
////        recyclerView.setRefreshProgressStyle(ProgressStyle.BallZigZag)
////        recyclerView.setLoadingMoreProgressStyle(ProgressStyle.BallZigZag)
////        // 设置刷新样式:图标
////        recyclerView.setArrowImageView(R.drawable.iconfont_downgrey)
////        // 设置需要时间
////        recyclerView.defaultRefreshHeaderView!!.setRefreshTimeVisible(false)
////        // 设置加载更多相关信息
////        recyclerView.defaultFootView!!.setLoadingHint("正在加载...")
////        recyclerView.defaultFootView!!.setNoMoreHint("已全部加载")
//////        recyclerView.defaultFootView!!.setLoadingViewBackgroundColor(R.color.load_more_bg)
////        // 设置头部
////        val header: View = LoadingRecycleViewHeader.getViewByLayoutId(this@LoadingRecycleStaggeredGridTestActivity, R.layout.recyclerview_header)
////        recyclerView.addHeaderView(header)
////
////        // When the item number of the screen number is list.size-2,we call the onLoadMore
////        recyclerView.setLimitNumberToCallLoadMore(2)
////
////        recyclerView.setLoadingListener(object : LoadingRecyclerView.LoadingListener {
////            override fun onRefresh() {
////
////                times = 0
////                Handler().postDelayed({
////
////                    listData!!.clear()
////
////                    for (i in 0 until pageSize) {
////                        listData!!.add("item_$i")
////                    }
////
////                    mAdapter!!.replaceAll(listData)
////                    mAdapter!!.notifyDataSetChanged()
////
////                    if (recyclerView != null)
////                        recyclerView.refreshComplete()
////
////                }, 1000)            //refresh data here
////            }
////
////            override fun onLoadMore() {
////
////                if (times < 2) {
////
////                    Handler().postDelayed({
////
////                        for (i in 0 until pageSize) {
////
////                            listData?.add("item" + (1 + listData!!.size))
////                        }
////
////                        recyclerView?.loadMoreComplete()
////                        mAdapter?.notifyDataSetChanged()
////
////                    }, 1000)
////
////                } else {
////
////                    Handler().postDelayed({
////                        for (i in 0 until pageSize) {
////                            listData?.add("item" + (1 + listData!!.size))
////                        }
////
////                        recyclerView?.setNoMore(true)
////                        mAdapter?.notifyDataSetChanged()
////
////                    }, 1000)
////
////                }
////                times++
////            }
////        })
//    }
//
//
//    override fun onDestroy() {
//        super.onDestroy()
//        // release memory
//        if (recyclerView != null) {
////            recyclerView.destroy()
//        }
//    }
//
//}